<?php

class SemestreController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
       // $this->view->serveur_alerte_url = Zend_Registry::get('alerte_Url');
    }

    public function indexAction()
    {
    	$this->view->title = "Liste des semestres";
        $this->view->headTitle($this->view->title);
      
    }
    
    /**
     * Gestion du direct
     * @return unknown_type
     */
	public function listAction()
    {
      $this->_helper->viewRenderer->setNoRender();
               $this->_helper->getHelper('layout')->disableLayout();
               
               $semestre = new Default_Model_DbTable_Semestre();
               $u = $semestre->select();
       
               $u = $semestre->fetchAll($u);

               $u = $u->toArray();
               $res = array();
       
               
               
               foreach ($u as $val){
                       $v['id'] = $val['idsemestre'];
                       $v['cell'] = $val;
                       $res[]= $v;
               }

               
               $resultat = Zend_Json :: encode($res);
               $this->_response->setBody($resultat);
    }
    

	public function comboAction()
    {
      $this->_helper->viewRenderer->setNoRender();
      $this->_helper->getHelper('layout')->disableLayout();
      $semestre = new Default_Model_DbTable_Semestre();
      $u = $semestre->select();
      $u = $semestre->fetchAll($u);
      $u = $u->toArray();
      $res = array();
      foreach ($u as $val){
      	$v['value'] = $val['idsemestre'];
      	$v['libelle'] = $val['libsemestre'];
      	
      	$res[]= $v;
      }
      $resultat = Zend_Json :: encode($res);
      $this->_response->setBody($resultat);
    }
    

    
    
  
    
}
    
